---
title: Automated deployment and replacement of Scoring Code in Snowflake
description: Create a DataRobot-managed Snowflake prediction environment to deploy and replace DataRobot Scoring Code in Snowflake.
section_name: MLOps
maturity: public-preview
---

# Automated deployment and replacement of Scoring Code in Snowflake {: #automated-deployment-and-replacement-of-scoring-code-in-snowflake }

!!! info "Availability information"
    Automated deployment and replacement of Scoring Code in Snowflake is off by default. Contact your DataRobot representative or administrator for information on enabling this feature.

    <b>Feature flag:</b> Enable the Automated Deployment and Replacement of Scoring Code in Snowflake

Now available for Public Preview, you can create a DataRobot-managed Snowflake prediction environment to deploy DataRobot Scoring Code in Snowflake. With DataRobot management enabled, the external Snowflake deployment has access to MLOps management, including automatic Scoring Code replacement.


## Create a Snowflake prediction environment {: #create-a-snowflake-prediction-environment }

To deploy a model in Snowflake, you first create a custom Snowflake prediction environment: 

1. Click **Deployments** > **Prediction Environments** and then click **Add prediction environment**.

    ![](images/pred-env-3.png)

2. In the **Add prediction environment** dialog box, configure the prediction environment settings:

    ![](images/pred-env-settings.png)

    * Enter a descriptive **Name** and an optional **Description** of the prediction environment.

    * Select **Snowflake** from the **Platform** drop-down list. The **Supported Model Formats** settings are automatically set to **DataRobot Scoring Code** and can't be changed, as this is the only model format supported by Snowflake.

    * Enable the **Managed by DataRobot** setting to allow this prediction environment to automatically package and deploy DataRobot Scoring Code models through the Management Agent.

        !!! note
            DataRobot management of Scoring Code in Snowflake requires an existing **Data Connection** to Snowflake with stored **Credentials**. If you don't have an existing Snowflake data connection, the **No Data Connections found** alert appears, directing you to **Go to Data Connections** to [create a Snowflake connection](dc-snowflake).

            ![](images/create-connection-alert.png)

    * Select a **Data Connection** and the related **Credentials**, and then select the Snowflake **Schemas**. Snowflake schemas are collections of Snowflake tables.

3. After you configure the environment settings, click **Add environment**. 

    The Snowflake environment is now available from the **Prediction Environments** page.


## Deploy a model to the Snowflake prediction environment {: #deploy-a-model-to-the-snowflake-prediction-environment }

Once you've created a Snowflake prediction environment, you can deploy a model to it:

1. Click **Model Registry > Registered Models** and select the Scoring Code enabled model you want to deploy to the Snowflake prediction environment.

    ![](images/reg-select-deploy-model.png)

    !!! tip
        You can also deploy a model to your Snowflake prediction environment from the **Deployments** > **Prediction Environments** tab by clicking **+ Add new deployment** in the prediction environment.

2. On any tab in the registered model version, click **Deploy**.

    ![](images/reg-deploy-model.png)

3. In the **Select Deployment Target** dialog box, under **Select deploy target**, click **Snowflake**.

    ![](images/sf-deploy-target.png)

    !!! note
        If you can't click the Snowflake deployment target, the selected model doesn't have Scoring Code available.

4. Under **Select prediction environment**, select the Snowflake prediction environment you added, and then click **Confirm**.

    ![](images/sf-select-pred-env.png)

5. [Configure the deployment](add-deploy-info), and then click **Deploy model**.

6. Once the model is deployed to Snowflake, you can use the **Score your data** code snippet from the **Predictions > Portable Predictions** tab to score data in Snowflake.

## Restart a Snowflake prediction environment {: #restart-a-snowflake-prediction-environment }

When you update database settings or credentials for the Snowflake data connection used by the prediction environment, you can restart the environment to apply those changes to the environment:

1. Click **Deployments > Prediction Environments** page, and then select the Snowflake prediction environment from the list.

2. Below the prediction environment settings, under **Service Account**, click **Restart Environment**.

    ![](images/restart-prediction-environment.png)


